//
//  WMMusic.h
//  WholeMusic
//
//  Created by quanxiong on 2018/2/12.
//  Copyright © 2018年 quanxiong. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import <XQ_DAO/XQ_DAO.h>

typedef NS_ENUM(NSInteger, WMMusicQuality) {
    //flac > wav > ogg > ape > aac > mp3-320 > mp3-128
    WMMusicQuality128 = 0,
    WMMusicQuality320,
    WMMusicQualityApe,
    WMMusicQualityOgg,
    WMMusicQualityFlac,
    WMMusicQualityUnknow,
};

typedef NS_ENUM(NSInteger, WMMusicStatus) {
    WMMusicStatusUndownload = 0,
    WMMusicStatusDownloading,
    WMMusicStatusDownloaded,
    WMMusicStatusDownloadFail,
};

@interface WMQuality : NSObject
@property (copy, nonatomic) NSString *prefix;
@property (copy, nonatomic) NSString *suffix;

+ (instancetype)qualityWithPrefix:(NSString *)prefix suffix:(NSString *)suffix;
@end

@interface WMSinger : NSObject
//{
//    id = 208;
//    mid = 001QY1cc2SIqpB;
//    name = "\U6c34\U6728\U5e74\U534e";
//    "name_hilight" = "<span class=\"c_tx_highlight\">\U6c34\U6728\U5e74\U534e</span>";
//}

XQ_DB_PROPERTY

@property (assign, nonatomic) NSInteger ID;
@property (copy, nonatomic) NSString *mid;
@property (copy, nonatomic) NSString *name;

@end




@interface WMMusic : NSObject

XQ_DB_PROPERTY

// albumid = 7898;
@property (assign, nonatomic) NSInteger albumid;
// albummid = 002crMyE3ufJp4;
@property (copy, nonatomic) NSString *albummid;
// albumname = "\U4e00\U751f\U6709\U4f60";
@property (copy, nonatomic) NSString *albumname;
// alertid = 100002;
@property (assign, nonatomic) NSInteger alertid;
// chinesesinger = 0;
@property (assign, nonatomic) NSInteger chinesesinger;
// interval = 258;
//@property (assign, nonatomic) NSInteger interval;
// isonly = 1;
//@property (assign, nonatomic) BOOL isonly;
// lyric = "";

// msgid = 14;
@property (assign, nonatomic) NSInteger msgid;
// nt = 3993841182;
@property (assign, nonatomic) NSInteger nt;

// singer =                     (
// );
@property (strong, nonatomic) NSArray<WMSinger *> *singer;

// size128 = 4132745;
// size320 = 10329332;
// sizeape = 26757988;
// sizeflac = 27307243;
// sizeogg = 5422659;
@property (assign, nonatomic) NSInteger size128;
@property (assign, nonatomic) NSInteger size320;
@property (assign, nonatomic) NSInteger sizeape;
@property (assign, nonatomic) NSInteger sizeflac;
@property (assign, nonatomic) NSInteger sizeogg;

// songid = 95484;
@property (assign, nonatomic) NSInteger songid;
// songmid = 002pYWH50s7112;
@property (copy, nonatomic) NSString *songmid;
// songname = "\U4e00\U751f\U6709\U4f60";
@property (copy, nonatomic) NSString *songname;

// stream = 10;
@property (assign, nonatomic) NSInteger stream;
// switch = 636675;
@property (assign, nonatomic) NSInteger SWITCH;


// 下载/播放 地址
@property (copy, nonatomic) NSString *musicUrl; //网络下载地址
@property (copy, nonatomic) NSString *fileName; //当前使用中的文件名
@property (assign, nonatomic) WMMusicStatus status;

//收藏夹名称，为空时表示未收藏，默认为“最爱”
@property (copy, nonatomic) NSString *favorite;
// qq/baidu/netease/xiami...
@property (copy, nonatomic) NSString *type;

+ (instancetype)queryWithMusic:(WMMusic *)music;
+ (instancetype)queryWithSontmid:(NSString *)sontmid;

- (CGFloat)fileSize;

- (NSString *)filePath; //当前使用中的文件路径

- (NSString *)defaultFilePath; // 默认文件路径
- (NSString *)defaultFileDirectory; // 默认文件路径
- (NSString *)defaultFileName; // 默认音乐文件名
- (WMQuality *)defaultQuality; // 默认的音乐质量

- (NSString *)fileNameForQuality:(WMMusicQuality)quality qualityFirst:(BOOL)qualityFirst;
- (WMQuality *)guessQualityForQuality:(WMMusicQuality)quality qualityFirst:(BOOL)qualityFirst;

@end




// "albumname_hilight" = "\U4e00\U751f\U6709\U4f60";
// docid = 7314883995533254896;
//@property (assign, nonatomic) NSInteger docid;

// grp =                     (
// );
// "lyric_hilight" = "";
// pay =                     {
// payalbum = 0;
// payalbumprice = 0;
// paydownload = 1;
// payinfo = 1;
// payplay = 0;
// paytrackmouth = 1;
// paytrackprice = 200;
// };

// preview =                     {
// trybegin = 64675;
// tryend = 83635;
// trysize = 304273;
// };

// pubtime = 1001433600;
// pure = 0;
// "songname_hilight" = "\U4e00\U751f\U6709\U4f60";
// t = 1;
// tag = 0;
// type = 0;
// ver = 0;
// vid = "";
